<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<%@ include file="/WEB-INF/view-system/include/contentTaglib.jsp"%>
<%@ include file="/WEB-INF/view-system/include/myTaglib.jsp"%>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<script src="${ctxStaticSystem }/js/role/role.js" type="text/javascript"></script>
    <link href="${ctxStaticSystem }/css/roleManage/roleManage.css" rel="stylesheet" type="text/css"/>
	<title>角色管理</title>
</head>
<tags:dataSet id="roleInfoSet">
	<tags:dataField name="roleId" display="" visiable="false" />
	<tags:dataField name="roleName" display="角色名称" width="20%" cssClass="table-header-center" />
	<tags:dataField name="roleType" display="角色类型" sort="false" width="20%" cssClass="table-header-center"/>
	<tags:dataField name="remark" display="备注" sort="false" width="20%" cssClass="table-header-center"/>
	<tags:dataField name="state" display="状态" sort="false" width="10%" cssClass="table-header-center"/>
	<tags:dataField name="roleOperation" display="操作" sort="false" width="20%" cssClass="table-header-center"/>
</tags:dataSet>
<!-- 角色表查询 -->
<tags:ajax id="queryRoleInfoListAjax" url="${ctx }/sys/roleMgr/roleList" autoSend='false' type='post'
	formSubmit="true" formQuery="#rolesTableFrm" onSuccess="ajaxEvents.onTableLoadSucc"/>
<!-- 菜单树查询 -->
<tags:ajax id="queryMenusRoleAjax" url="${ctx}/sys/menuMgr/list" type="post" autoSend="true" onSuccess="ajaxEvents.resetA"/>
	
<!-- 查询单个角色的资源信息 -->
<tags:ajax id="queryItemResourceAjax" url="${ctx }/sys/roleMgr/queryResource" autoSend="false" contentType="application/x-www-form-urlencoded"
	type="post" onSuccess="ajaxEvents.onQueryResourceSucc"/>
<!-- 删除角色信息 -->
<tags:ajax id="deleteRolesAjax" url="${ctx }/sys/roleMgr/deleteRoles" autoSend="false" contentType="application/x-www-form-urlencoded"
	type="post" onSuccess="ajaxEvents.onDeleSucc"/>
<!-- 修改角色信息：基本信息 -->
<%--<tags:ajax id="editRoleInfoAjax" url="${ctx }/sys/roleMgr/editRole" autoSend="false" contentType="application/x-www-form-urlencoded" type="post"
	onSuccess="ajaxEvents.onEditInfoSucc"/>--%>
<!-- 修改角色信息：资源信息 -->
<tags:ajax id="editRoleResourceAjax" url="${ctx }/sys/roleMgr/editRoleResorce" autoSend="false" contentType="application/x-www-form-urlencoded"
	type="post" onSuccess="ajaxEvents.onEditResourceSucc"/>
<!-- 新增角色信息 -->
<tags:ajax id="addRoleAjax" url="${ctx }/sys/roleMgr/createRole" autoSend="false" contentType="application/x-www-form-urlencoded" type="post"
	onSuccess="ajaxEvents.onCreateSucc"/>
<body>
	<tags:boards>
		<tags:board width="30%" boardTitle="菜单树">
			<div id="showTree">
				<div class="col-md-10">
					<span>设置角色：</span>
					<select id="roleNameList" onchange="getMenus()">
					</select>
				</div>
				<div class="treeSave treeSave">
					<span title="保存">
						<a href="javascript:void(0);" onclick="buttonEvents.onSaveResource()">
							<i class="icon icon-save"></i>
						</a>
					</span>
				</div>
				<!-- 遮罩层 -->
				<div id="orgloading" class="orgloading" style="display: none">
					<i class="icon icon-spin icon-spinner-indicator icon-3x"></i>
				</div>
				<div class="col-md-12">
					<tags:tree ajax="queryMenusRoleAjax" id="menusTreeqw" showLine="true"
						selectedMulti="true"
						nodeNameKey="menuName" checkable="true" nodeId="menuId" parentId="parMenuId"
						nodeChildrenKey="childrenList" nodeTitleKey="menuName"
						onCurrentNodeSelected="ajaxEvents.resetA" />
				</div>
			</div>
		</tags:board>
		<tags:board width="70%" boardTitle="角色明细">
		<div class="roleTableArea">
			<form action="" id="rolesTableFrm">
				<div class="col-md-6">
					<div class="input-group searDiv">
						<input type="text" name="roleName" class="form-control" placeholder="角色名称">
				  		<span class="input-group-btn">
							<button class="btn btn-primary m-btn" type="button" onclick="searchName()">搜索</button>
						</span>
					</div>
				</div>
				<div class="roleBtnArea col-md-6">
					<button class="btn btn-primary m-btn" onclick="buttonEvents.onBatchDelete();return false;">批量删除</button>
					<button class="btn btn-success m-btn" onclick="buttonEvents.onAddRole();return false;">新增</button>
				</div>
				<div class="col-md-12">
				<tags:datatable id="roleDatatable" storage="false"
					ajax="queryRoleInfoListAjax" pagination="roleManaPagination"
					dataSet="roleInfoSet" checkable="true"
					striped="true" cutLine="true" border="true"
					onRenderItem="tablezEvents.onRenderItem"
					onChecksChanged="tablezEvents.onSingleClick"
					onDoubleClick="tablezEvents.onDoubleClick"
					afterReady="tablezEvents.onAfterReady"/>
				<tags:pagination pageSize="10" id="roleManaPagination" 
					pageChoice="10" datatable="roleDatatable" />
				</div>
			</form>
		</div>
	</tags:board>
	</tags:boards>
	
	<!-- 修改页面dialog -->
	<%--<tags:dialog id="roleEditDialog">
		<tags:dialogHeader title="角色信息修改"/>
		<tags:dialogBody>
			<div>
				<form action="" id="roleOldInfoFrm">
					<input name="roleId" style="display:none">
					<div class="col-sm-12 outr">
						<div class="col-md-3 iname">
							<span>角色名称：</span>
						</div>
						<div class="col-md-9">
							<input name="roleName" type="text" class="inputC form-control">
						</div>
					</div>
					<div class="col-sm-12 outr">
						<div class="col-md-3 iname">
							<span>角色类型：</span>
						</div>
						<div class="col-md-9">
							 <tags:dropcode codeType="roleType" id="dropRoleType" name="roleType" 
							 	className="inputC form-control" showSelectAll="true" showSelectName="空值"
							 	showSelectValue=""/>
						</div>
					</div>
					<div class="col-sm-12 outr">
						<div class="col-md-3 iname">
							<span>状态：</span>
						</div>
						<div class="col-md-9">
							<select name="state" class="inputC form-control">
								<option value="1">启用</option>
								<option value="0">禁用</option>
							</select>
						</div>
					</div>
					<div class="col-sm-12 outr">
						<div class="col-md-3 iname">
							<span>备注：</span>
						</div>
						<div class="col-md-9">
							<textarea rows="3" cols="" name="remark" class="inputC form-control"></textarea>
						</div>
					</div>
				</form>
			</div>
		</tags:dialogBody>
		<tags:dialogFooter>
			<div>
				<div class="col-sm-12">
					<button class="btn btn-primary m-btn" onclick="buttonEvents.onUpdateItem()">提交修改</button>
					<button class="btn btn-default m-btn" onclick="buttonEvents.closeDia()">取消</button>
				</div>
			</div>
		</tags:dialogFooter>
	</tags:dialog>--%>
	
	<%--<tags:dialog id="createRoleDialog">
		<script src="${ctxStaticSystem }/js/role/role.js" type="text/javascript"></script>
    	<link href="${ctxStaticSystem }/css/roleManage/roleManage.css" rel="stylesheet" type="text/css"/>
		<tags:dialogHeader title="新增角色信息"/>
		<tags:dialogBody>
			<form action="" id="createRoleFrm">
					<div class="col-sm-12 outr">
						<div class="col-md-3 iname">
							<span>角色名称：</span>
						</div>
						<div class="col-md-9">
							<input name="roleName" type="text" class="inputC form-control" required="required">
						</div>
					</div>
						<div class="col-sm-12 outr">
						<div class="col-md-3 iname">
							<span>角色类型：</span>
						</div>
						<div class="col-md-9">
							<!-- <input name="roleType" type="text" class="inputC form-control"> -->
							<tags:dropcode codeType="roleType" id="dropRoleType" name="roleType" 
							 	className="inputC form-control" showSelectAll="true" showSelectName="空值"
							 	showSelectValue=""/>
						</div>
					</div>
					<div class="col-sm-12 outr">
						<div class="col-md-3 iname">
							<span>状态：</span>
						</div>
						<div class="col-md-9">
							<select name="state" class="inputC form-control">
								<option value="1" selected="selected">启用</option>
								<option value="0">禁用</option>
							</select>
						</div>
					</div>
					<div class="col-sm-12 outr">
						<div class="col-md-3 iname">
							<span>等级：</span>
						</div>
						<div class="col-md-9">
							<input name="gradeLevel" type="number" class="inputC form-control">
						</div>
					</div>
					<div class="col-sm-12 outr">
						<div class="col-md-3 iname">
							<span>备注：</span>
						</div>
						<div class="col-md-9">
							<textarea rows="" cols="" name="remark" class="inputC form-control"></textarea>
						</div>
					</div>
			</form>
		</tags:dialogBody>
		<tags:dialogFooter>
			<div>
				<div class="col-sm-12"><!-- editBtnArea -->
					<button class="btn btn-primary m-btn" onclick="buttonEvents.commitAddRoleInfo()">提交</button>
					<button class="btn btn-default m-btn" onclick="buttonEvents.closeDia()">取消</button>
				</div>
			</div>
		</tags:dialogFooter>
	</tags:dialog>--%>
</body>
</html>